package com.ball.dev.controller;


import com.ball.common.dtos.ResponseResult;
import com.ball.dev.entity.po.PostComment;
import com.ball.dev.service.IPostCommentService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

/**
 * 帖子的评论
 *
 * @author lou
 * @since 2024-04-10
 */
@RestController
@RequestMapping("/postComment")
@RequiredArgsConstructor
public class PostCommentController {

    private final IPostCommentService postCommentService;
   // 添加中文注释后
  @PostMapping("/addComment")
    // 添加评论
    public ResponseResult postComment(@RequestBody PostComment dto) {
        // 调用服务层添加评论
        return postCommentService.addComment(dto);
    }
    @GetMapping("/getPostComments/{postId}")
    // 获取文章评论
    public ResponseResult getPostComments(@PathVariable("postId") String postId) {
        // 调用服务层获取文章评论
        return postCommentService.getPostComments(postId);
    }
}
